//C13:ep13_1: Enter some chars, store them to disk, when char is '#' stoped.
#include <stdio.h>
#include <stdlib.h>

int main(void)
{
    FILE *fp;
    char ch;
    char filename[10];

    scanf("%s", filename);
    if((fp = fopen(filename, "w")) == NULL)
    {
        printf("cannot open file\n");
        exit(0);
    }
    ch = getchar();    // get the "\r"
    ch = getchar();    // get the first char
    while(ch != '#')
    {
        fputc(ch, fp);
        putchar(ch);
        ch = getchar();
    }

    putchar(10);    // output '\n' to console
    exit(0);
}
